/**
 * @Author: 焦质晔
 * @Date: 2019/6/20
 * @Last Modified by: mikey.zhaopeng
 * @Last Modified time: 2019-12-20 17:41:03
 */
import axios from '@/api/fetch';
import * as types from './types';
import SERVER from '@/api/server';

// 登录
export const doLogin = params => axios.post(`https://dcs-test-api.livanauto.com/api/cms_sysManage/login`, params, { mark: types.LOGIN });
// GUC登录
export const doGUCLogin = params => axios.post(`https://dcs-test-api.livanauto.com/api/sysManage/login/guclogin`, params);
// 发送手机验证码
export const sendPhoneCode = params => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/login/sendSms`, { params });
//点击切换验证码
export const refreshVerification = params => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/login/refreshVerification`, { params });

// 登录初始化
export const initLogin = () => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/login/userDetailData`);

// 获取用户信息
export const getUserInfo = () => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/commonDatas`);
// 获取用户头像
export const getHeadPortrait = () => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/login/getHeadPortrait`);

/*登录接口迁移*/
export const getInfo = token => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/login/getMenus`);

export const getDict = token => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/dicts`);

export const getAuthHandle = token => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/login/handles`);

export const logout = () => axios.get(`/api/logout`);

export const foo = () => axios.get(`/user/success`);

// 收藏
export const favorite = params => axios.post(`https://dcs-test-api.livanauto.com/api/cms_sysManage/login/favorite`, params);

// 首页
export const getHomeData = () => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/homePage/queryForSalesHome`);

// 退出jwt接口
export const logoutJwt = params => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/login/logout?jwt=${params}`);


//登陆成功后拦截
export const roleDetail = params => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/login/roleDetail`);

//登陆成功后拦截后保存角色
export const setUserRole = params => axios.post(`https://dcs-test-api.livanauto.com/api/cms_sysManage/login/setUserRole`, params);

//查询通知
export const getNoticePanel = params => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/dealer/msgRecord?currentPage=1&pageSize=10&queryCondition=`);

// 通知所有内容
export const noRead = params => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/notification/getNoticeInfo/noRead`);

//通知已读
export const putMsgRecord = params => axios.put(`https://dcs-test-api.livanauto.com/api/cms_sysManage/dealer/msgRecord/tz/10651002`,);

//微信登录
export const weChatLogin = params => axios.post(`${SERVER.WXDMSCLOUD_BASEDATA_GUC}/wechat/w_login`);
//微信登录
export const weChatCallback = params => axios.post(`${SERVER.WXDMSCLOUD_BASEDATA_GUC}/wechat/callback`, params);

// 获取微信验证码
export const sendSms = params => axios.post(`${SERVER.WXDMSCLOUD_BASEDATA_GUC}/wechat/sendSms`, params);
//绑定手机号
export const accountBinding = params => axios.post(`${SERVER.WXDMSCLOUD_BASEDATA_GUC}/wechat/accountBinding`, params);
//验证码登陆
export const getVerificationCode = (params) => axios.post(`${SERVER.WXDMSCLOUD_BASEDATA_GUC}/login/verificationCode?phone=${params.phone}&appId=${params.appId}`);
//正常登录时候绑定手机号/继续绑定手机号
export const postBindingPhone = (params) => axios.post(`${SERVER.WXDMSCLOUD_BASEDATA_GUC}/login/bindingPhone`, params);
// 忘记密码
export const getSendSms = (phone, appId) => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/login/sendSms?smsType=3&phone=${phone}&appId=${appId}`);
// 忘记密码重置密码
export const forgetUpdatePassword = (params) => axios.post(`https://dcs-test-api.livanauto.com/api/cms_sysManage/login/ignore/forgetUpdatePassword`, params);
//判断售前售后
export const afterSale = phone => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/dealerInfo/afterSale`);
//判断指销售
export const getDealerType = phone => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/dealerInfo/getDealerType`);

//下载APP
export const queryAppVersionByApp = phone => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/version/queryAppVersionByApp`);
//下载appNEW
export const queryDataByAppType = params => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/version/queryDataByAppType`, { params });

// 判断有没有短信微信登陆
export const getSmsWx = (appId) => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/login/getSmsWx?appId=${appId}`);
//90天超期
export const needUpdate = () => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/login/needUpdate`);

//获取售后相关信息
export const getUserPermissionCtrl = () => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/basedata/users/getUserPermissionCtrl`);

export const getNavList = () => axios.get(`https://dcs-test-api.livanauto.com/api/cms_sysManage/login/getMenus`);
